var path = "http://khdjk.suxin88.com:808/"

export default {
		login({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'login',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	grapstart({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'grapstart',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	confirmrecharge({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'confirmrecharge',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	cancelrecharge({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'cancelrecharge',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	grapend({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'grapend',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	chongzhi({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'grapend',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	recharge({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'recharge',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	takeorder({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'takeorder',
				data: data,
				success: (res) => {
					commit("orderdel", res.data.data.order_id)
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
		uerinfo({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'personinfo',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("userinfo", res.data.data.info)
						
					}
					else if(res.data.code == 0){
						commit("userinfo", {})
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	orderallocated({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'orderallocated',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("onceorder", res.data.data)
					}
					else if(res.data.code == 0){
						commit("onceorder", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	shouyi({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'moneydetail',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("shouyi", res.data.data)
						
					}
					else if(res.data.code == 0){
						commit("shouyi", {})
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	liushui({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'moneydetail',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("liushui", res.data.data)
						
					}
					else if(res.data.code == 0){
						commit("liushui", {})
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	rujindetail({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'rujindetail',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("rujindetail", res.data.data)
						
					}
					else if(res.data.code == 0){
						commit("rujindetail", {})
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	chujindetail({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'chujindetail',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("chujindetail", res.data.data)
						
					}
					else if(res.data.code == 0){
						commit("chujindetail", {})
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
		heart({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'heartbeat',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	ordertimeout({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'ordertimeout',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	confirmreceitp({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'confirmreceipt',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},

		getbank({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'getbank',
				data: data,
				success: (res) => {
						resolve(res)
					if (res.data.code == 1) {
						commit("getbank", res.data.data)
					
					}
					else if(res.data.code == 0){
						commit("getbank", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	postnotice({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'postnotice',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("gonggao", res.data.data)
						
					}
					else if(res.data.code == 0){
						commit("gonggao", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	ploatformlist({
		commit,
		state
	}, data) {
	
			uni.request({
				url: path + 'ploatformlist',
				data: data,
				success: (res) => {
					if (res.data.code == 1) {
						commit("ploatformlist", res.data.data)
						
					}
					else if(res.data.code == 0){
						commit("ploatformlist", [])
					}
				},
				fail: (err) => {
					// reject(err)
				}
		
		});
	
	},
	qrcodelist({
		commit,
		state
	}, data) {
	
			uni.request({
				url: path + 'qrcodelist',
				data: data,
				success: (res) => {
					if (res.data.code == 1) {
						commit("qrcodelist", res.data.data)
					}
					else if(res.data.code == 0){
						commit("qrcodelist", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
		
		});
	
	},
	withdraw({
		commit,
		state
	}, data) {
	return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'withdraw',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
		
		});
		});
	
	},
		updatepasswd({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'passedit',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	editqrcodestatus({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'editqrcodestatus',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	addcard({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'addcard',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	editcard({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'editcard',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},

		resetpass({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'passreset',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	addqrcode({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'addqrcode',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
	editqrcode({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'editqrcode',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
		register({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'register',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	},
		logout({
		commit,
		state
	}, data) {
	return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'logout',
				data: data,
				success: (res) => {
		resolve(res)
				
				},
				fail: (err) => {
						
				}
			});
			});
	
	},
			cardlist({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'cardlist',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("cardlist", res.data.data)
						
					}
					else if (res.data.code == 0){
						commit("cardlist", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	orderunderway({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'orderunderway',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("orderunderway", res.data.data)
						
					}
					else if (res.data.code == 0){
						commit("orderunderway", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	alldingdan({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'historyorder',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("alldingdan", res.data.data)
					}
						else if(res.data.code == 0){
						commit("alldingdan", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	wancdingdan({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'historyorder',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("wancdingdan", res.data.data)
					}
					else if(res.data.code == 0){
						commit("wancdingdan", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	chaodingdan({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'historyorder',
				data: data,
				success: (res) => {
					resolve(res)
					if (res.data.code == 1) {
						commit("chaodingdan", res.data.data)
					}
					else if(res.data.code == 0){
						commit("chaodingdan", [])
					}
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	
	},
	getcode({
		commit,
		state
	}, data) {
		return new Promise(function(resolve, reject) {
			uni.request({
				url: path + 'sendsms',
				data: data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}
			});
		});
	}
	
}
